/*
 * =====================================================================================
 *
 *       Filename:  my.h
 *
 *    Description:  my header file
 *        Version:  1.0
 *        Created:  
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:   (),
 *        Company:  NDSL UESTC
 *
 * =====================================================================================
 */

#include    <signal.h>
#include    <sys/types.h>
#include    <sys/wait.h>
#include    <sys/socket.h>
#include    <sys/epoll.h>
#include    <arpa/inet.h>
#include    <netinet/in.h>
#include    <stdlib.h>
#include    <string.h>
#include    <errno.h>
#include    <unistd.h>
#include    <fcntl.h>
#include    <poll.h>
#include    <time.h>
#include    <iostream>
#include    <semaphore.h>
#include    <map>

using namespace std;
using std::cout;
using std::cerr;
using std::endl;
using std::map;

#define     SA  struct      sockaddr

#ifndef     HEADER_MESSAGE_TYPE
#define     HEADER_MESSAGE_TYPE
const int   MAXLINE  = 4096;    /*  max text line length */
const int   EPOLLMAX = 4096; 
const int   LISTENQ  = 1024;    /*  2nd argument to listen() */

typedef enum
{
    START,
    CONNECTED,
    END,
}statusstruct;

inline int setnonblock(int set_fd)
{
    int flag = 0;
    if ( 0 > fcntl(set_fd, F_GETFL, 0))
    {
        cerr<<"fcntl F_GETFL error:"<<strerror(errno)<<endl;
        return -1;
    }
    flag |= O_NONBLOCK;
    if ( 0 > fcntl(set_fd, F_SETFL, flag))
    {
        cerr<<"fcntl F_SETFL error:"<<strerror(errno)<<endl;
        return -1;
    }

    return 0;
}

class Base
{
    public:
        virtual void f(float x){ cout<<"Base::f(float):"<<x<<endl;}
                void g(float x){ cout<<"Base::g(float):"<<x<<endl;}
                void h(float x){ cout<<"Base::h(float):"<<x<<endl;}
        virtual void i(float x){ cout<<"Base::i(float):"<<x<<endl;}
};

class Derived:public Base
{
    public:
        virtual void f(float x){ cout<<"Derived::f(float):"<<x<<endl;}
                void g(int   x){ cout<<"Derived::g(float):"<<x<<endl;}
                void h(float x){ cout<<"Derived::h(float):"<<x<<endl;}
        virtual void i(int   x){ cout<<"Base::i(int):"<<x<<endl;}
};
#endif
